//
//  WDGroMorePublic.h
//  WDGroMore
//
//  Created by little People on 2023/7/24.
//
//1.3.1
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
//in-appPurchase
typedef void(^onProductListCallBack) (NSArray * lists);
typedef void(^onInAppPurchaseCallBack) (BOOL isSuccess, NSString *errorMsg, NSString *info);
typedef void(^onBeginInAppPurchaseCallBack) (NSString *productId);
typedef void(^onRestoreInAppPurchaseCallBack) (BOOL isSuccess, NSString *errorMsg, NSString *productId);
typedef void(^onBeginRestoreInAppPurchaseCallBack) (NSString *productId);
typedef void(^BMSInitCompletion)(BOOL success,
                                 BOOL privacyAgreed,
                                 BOOL trackingAuthorized,
                                 BOOL didRealname,
                                 NSString *uuid);
NS_ASSUME_NONNULL_BEGIN

@interface WDGroMorePublic : NSObject

@property(nonatomic,assign)BOOL isWebview;

@property (nonatomic, assign) BOOL unityPro;

@property (nonatomic, assign) BOOL success;

@property (nonatomic, copy) NSString *uuid;

@property (nonatomic, assign) BOOL shouldShowRealnamePopup;

@property (nonatomic, assign) BOOL realNameIng;

+ (instancetype)manager;
@property(nonatomic)BOOL isDebug;
@property(nonatomic)BOOL isUnity;

//日志开关。YES开，NO关
- (void)WDLogEnable:(BOOL)flag;

- (void)GroMoreDelegate:(id)delegate;
- (void)initWindMillAdsWithNetworkDetection:(BOOL)detection;
- (void)showGroMoreRewardVideoAd;
- (void)showRewardedAdWithRootVC:(UIViewController *)rootVC;
- (void)showGroMoreIntersititialAd;
- (void)showGroMoreBannerAdWithTop:(BOOL)top;
- (void)GroMoreCloseBannerAd;
- (void)GroMoreShowSplashAd;
- (void)tryShowSplashAdWithLaunch;
- (void)GroMoreShowNativeAd;

/// 显示原生广告（支持位置与偏移）
/// @param position 0=底部，1=顶部
/// @param yOffset 相对于顶部或底部的偏移量，按 1334 高度比例缩放
- (void)showNativeAdAtPosition:(NSInteger)position yOffset:(CGFloat)yOffset;

/// 移除原生广告视图
- (void)removeNativeAd;

/// 埋点 SDK 初始化
- (void)initAnalyticsSDK;

- (void)thinkingEventWithKey:(NSString *)key jsonStr:(id)jsonStr;

- (void)UMEventWithKey:(NSString *)key jsonStr:(id)jsonStr;


//开始内购 productId：商品ID
- (void)WDLaunchInAppPurchase:(NSString *)productId;
//恢复内购 productId：商品ID
- (void)WDRestoreInAppPurchase:(NSString *)productId;
//请求内购列表
- (void)WDRequestProductLists;

//banner方向，topDir--YES为顶部，NO为底部，需在调用WDShowBanner之前调用
- (void)WDBannerDirectionWithTop:(BOOL)topDir;
//获取BMS在线参数
- (NSDictionary *)WDGetBMSContent;


//inAppPurchase
@property (nonatomic,copy)onProductListCallBack __nullable onProductListCallBack;
@property (nonatomic,copy)onInAppPurchaseCallBack __nullable onInAppPurchaseCallBack;
@property (nonatomic,copy)onBeginInAppPurchaseCallBack __nullable onBeginInAppPurchaseCallBack;
@property (nonatomic,copy)onRestoreInAppPurchaseCallBack __nullable onRestoreInAppPurchaseCallBack;
@property (nonatomic,copy)onBeginRestoreInAppPurchaseCallBack __nullable onBeginRestoreInAppPurchaseCallBack;

/// 上报冷启动事件
/// - Parameters:
///   - launchOptions:
///   - connetOptions:
- (void)WDApplication:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;

///Deeplink clickid采集
- (void)WDApplication:(UIApplication *)application
              openURL:(NSURL *)url
              options:(nonnull NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options;

- (void)WDApplicationWillEnterForeground:(UIApplication *)application;

- (void)WDApplicationDidEnterBackground:(UIApplication *)application;


#pragma mark -------- BMS ----------

/// BMS 权限 SDK 初始化
/// - Parameter completion: 初始化回调
- (void)initSDKCompletion:(BMSInitCompletion)completion;

/// 触发隐私弹窗，回调用户是否同意
- (void)showPrivacyPopupWithCompletion:(void (^)(BOOL agreed))completion;

/// 判断是否需要弹出实名（基于后端或缓存逻辑）
- (BOOL)shouldShowRealname;

/// 主动触发实名弹窗
- (void)showRealnamePopupWithCompletion:(void (^)(BOOL success))completion;

/// 获取 BMS UUID
- (NSString *)BMSUUID;

/// 打开服务条款（默认实现，按需要替换 URL）
- (void)openTerms;

/// 打开隐私协议（默认实现，按需要替换 URL）
- (void)openPrivacy;

/// 打开 h5 页面
/// - Parameter url: url
-(void)openH5WithUrl:(NSString *)url;

/// 单次震动，默认样式（短促）
- (void)vibrateOnce;

/// 自定义震动（使用 CoreHaptics 模拟间隔+时长震动）
- (void)vibrateWithPattern:(NSArray<NSNumber *> *)pattern
                    repeat:(NSInteger)repeat;

/// 取消震动（如果可取消）
- (void)vibrateCancel;

/// 获取登录后唯一 UUID
- (NSString *)WDGetUserLoginUUID;

/// 获取钥匙串唯一 UUID
- (NSString *)WDGetKeyChainUUID;

@end

NS_ASSUME_NONNULL_END
